package com.monitor.controller;


import com.alibaba.fastjson2.JSONObject;
import com.monitor.commons.HttpTookit;
import com.monitor.config.yunke.YunKeConfig;
import com.monitor.config.yunke.YunKeUtil;
import lombok.extern.slf4j.Slf4j;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

import java.util.*;

@RequestMapping("/simStatus/")
@RestController(value = "simStatusController")
@Slf4j
public class SimStatusController {
    @Autowired
    private YunKeUtil yunKeUtil;
    @Autowired
    private YunKeConfig yunKeConfig;

    @PostMapping("condition")
    public String condition() throws Exception {
        //定义请求路径
        String url = yunKeConfig.getUrl() + "open/simstatus/conditionItem";
        //组装请求头
        long timestamp = new Date().getTime();
        Map<String, String> headsMap = yunKeUtil.getHeadMap(timestamp);
        //组装请求参数
        Map<String, Object> paramsMap = new HashMap<>();
        String res = HttpTookit.doPostHeader(url, paramsMap, headsMap);
        JSONObject resObject = JSONObject.parseObject(res);
        if (resObject.getBoolean("success")) {
            JSONObject dataObj = resObject.getJSONObject("data");


        }
        return res;
    }
}
